<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>GSoC2011SfM: D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/SequenceAnalyzer.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">GSoC2011SfM
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">Google Summer of Code 2011: Structure from motion</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/SequenceAnalyzer.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _GSOC_SFM_SEQUENCE_ANALYZER_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _GSOC_SFM_SEQUENCE_ANALYZER_H 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;macro.h&quot;</span> <span class="comment">//SFM_EXPORTS</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;PointsToTrackWithImage.h&quot;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;MotionProcessor.h&quot;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &quot;PointsMatcher.h&quot;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;PointOfView.h&quot;</span>
<a name="l00009"></a>00009 <span class="comment">//#include &quot;libmv_mapping.h&quot;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;TracksOfPoints.h&quot;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;opencv2/calib3d/calib3d.hpp&quot;</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="keyword">namespace </span>OpencvSfM{
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 
<a name="l00025"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html">00025</a>   <span class="keyword">class </span>SFM_EXPORTS <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>
<a name="l00026"></a>00026   {
<a name="l00027"></a>00027   <span class="keyword">protected</span>:
<a name="l00028"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a3038a412036acf7743cb6f2306a5d349">00028</a>     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a3038a412036acf7743cb6f2306a5d349" title="Minimum points detected into an image to keep this estimation (set to 20)">mininum_points_matches</a>;
<a name="l00029"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a2b2137918a91c3931b9688402783ea4e">00029</a>     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a2b2137918a91c3931b9688402783ea4e" title="Minimum images connections in a track to keep this estimation (usually set to 2)">mininum_image_matches</a>;
<a name="l00030"></a>00030 
<a name="l00033"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a38f83c0401b027598dce9117a6fb7a54">00033</a>     cv::Ptr&lt;cv::FeatureDetector&gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a38f83c0401b027598dce9117a6fb7a54">feature_detector_</a>;
<a name="l00037"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a4c10b16ab49da0a79c0f2804ff9ae655">00037</a>     cv::Ptr&lt;cv::DescriptorExtractor&gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a4c10b16ab49da0a79c0f2804ff9ae655">descriptor_extractor_</a>;
<a name="l00041"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a9e7d1e57d4ff2a80d5ce405e203020b9">00041</a>     std::vector&lt; cv::Ptr&lt; PointsToTrack &gt; &gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a9e7d1e57d4ff2a80d5ce405e203020b9">points_to_track_</a>;
<a name="l00045"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a07a0b188400adf992b78ada7db54de0e">00045</a>     std::vector&lt;cv::Mat&gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a07a0b188400adf992b78ada7db54de0e">images_</a>;
<a name="l00049"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a3c3ffb9390f94294e010d38e64bffc25">00049</a>     cv::Ptr&lt;PointsMatcher&gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a3c3ffb9390f94294e010d38e64bffc25">match_algorithm_</a>;
<a name="l00054"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#adb773da58cbaca8ff8d681b20c4007ab">00054</a>     std::vector&lt; cv::Ptr&lt; PointsMatcher &gt; &gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#adb773da58cbaca8ff8d681b20c4007ab">matches_</a>;
<a name="l00059"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#ab259863b967c142950a96bc472fd65ef">00059</a>     std::vector&lt;TrackOfPoints&gt; <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#ab259863b967c142950a96bc472fd65ef">tracks_</a>;
<a name="l00064"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a2f06b4e79d38b6fa0315751eeb545c81">00064</a>     <a class="code" href="class_opencv_sf_m_1_1_images_graph_connection.html" title="This class modelizes the images graph connections.">ImagesGraphConnection</a> <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a2f06b4e79d38b6fa0315751eeb545c81">images_graph_</a>;
<a name="l00065"></a>00065   <span class="keyword">public</span>:
<a name="l00074"></a>00074     <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>( <a class="code" href="class_opencv_sf_m_1_1_motion_processor.html" title="This class try to create a commun interface for files loading. Indeed, if you want to use webcam...">MotionProcessor</a> input_sequence,
<a name="l00075"></a>00075       cv::Ptr&lt;cv::FeatureDetector&gt; feature_detector,
<a name="l00076"></a>00076       cv::Ptr&lt;cv::DescriptorExtractor&gt; descriptor_extractor,
<a name="l00077"></a>00077       cv::Ptr&lt;PointsMatcher&gt; match_algorithm );
<a name="l00085"></a>00085     <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>(
<a name="l00086"></a>00086       std::vector&lt; cv::Ptr&lt; PointsToTrack &gt; &gt; &amp;points_to_track,
<a name="l00087"></a>00087       cv::Ptr&lt;PointsMatcher&gt; match_algorithm,
<a name="l00088"></a>00088       <span class="keyword">const</span> std::vector&lt;cv::Mat&gt; &amp;images );
<a name="l00094"></a>00094     <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>( cv::FileNode file,
<a name="l00095"></a>00095       std::vector&lt;cv::Mat&gt; &amp;images = std::vector&lt;cv::Mat&gt;() );
<a name="l00096"></a>00096 
<a name="l00100"></a>00100     ~<a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>( <span class="keywordtype">void</span> );
<a name="l00107"></a>00107     <span class="keywordtype">void</span> addNewImage( cv::Mat image,
<a name="l00108"></a>00108       cv::Ptr&lt;PointsToTrack&gt; points = cv::Ptr&lt;PointsToTrack&gt;( ) );
<a name="l00109"></a>00109 
<a name="l00116"></a>00116     <span class="keywordtype">void</span> computeMatches( );
<a name="l00120"></a>00120     <span class="keyword">static</span> <span class="keywordtype">void</span> keepOnlyCorrectMatches(
<a name="l00121"></a>00121       std::vector&lt;TrackOfPoints&gt;&amp; tracks,
<a name="l00122"></a>00122       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> min_matches = 10,
<a name="l00123"></a>00123       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> min_consistance = 3);
<a name="l00127"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#aae8a0cf3e6eb3443cda9c53dcb8902df">00127</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> keepOnlyCorrectMatches(
<a name="l00128"></a>00128       <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>&amp; tracks,
<a name="l00129"></a>00129       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> min_matches = 10,
<a name="l00130"></a>00130       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> min_consistance = 3)
<a name="l00131"></a>00131       {
<a name="l00132"></a>00132         keepOnlyCorrectMatches(tracks.<a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#af7c11e97664c050782bfc2d1808b219e">getTracks</a>(),min_matches,min_consistance);
<a name="l00133"></a>00133       }
<a name="l00137"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#af7c11e97664c050782bfc2d1808b219e">00137</a>     <span class="keyword">inline</span> std::vector&lt;TrackOfPoints&gt; &amp;<a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#af7c11e97664c050782bfc2d1808b219e">getTracks</a>( ){<span class="keywordflow">return</span> tracks_;};
<a name="l00141"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#aefda449985e3013c6ac2adc5f61151d4">00141</a>     <span class="keyword">inline</span> std::vector&lt; cv::Ptr&lt; PointsToTrack &gt; &gt; &amp;<a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#aefda449985e3013c6ac2adc5f61151d4">getPoints</a>( ){
<a name="l00142"></a>00142       <span class="keywordflow">return</span> points_to_track_;};
<a name="l00143"></a>00143 
<a name="l00148"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a2354ea088e81bcec7e85ceceebda7e21">00148</a>     <span class="keyword">inline</span> <a class="code" href="class_opencv_sf_m_1_1_images_graph_connection.html" title="This class modelizes the images graph connections.">ImagesGraphConnection</a>&amp; getImgGraph( )
<a name="l00149"></a>00149     {
<a name="l00150"></a>00150       <span class="keywordflow">if</span>( !images_graph_.isGraphCreated( images_.size( ) ) )
<a name="l00151"></a>00151         constructImagesGraph( );
<a name="l00152"></a>00152       <span class="keywordflow">return</span> images_graph_;
<a name="l00153"></a>00153     };
<a name="l00158"></a>00158     <span class="keywordtype">void</span> showTracks( <span class="keywordtype">int</span> timeBetweenImg=25 );
<a name="l00164"></a>00164     <span class="keywordtype">void</span> showTracks( <span class="keywordtype">int</span> img_to_show, <span class="keywordtype">int</span> timeBetweenImg );
<a name="l00168"></a>00168     <span class="keywordtype">void</span> showTracksBetween( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> img1, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> img2 );
<a name="l00169"></a>00169 
<a name="l00175"></a>00175     <span class="keyword">static</span> <span class="keywordtype">void</span> read( <span class="keyword">const</span> cv::FileNode&amp; node, <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>&amp; points );
<a name="l00176"></a>00176     
<a name="l00182"></a>00182     <span class="keyword">static</span> <span class="keywordtype">void</span> write( cv::FileStorage&amp; fs, <span class="keyword">const</span> <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html" title="This class tries to match points in the entire sequence. It follow ideas proposed by Noah Snavely: Mo...">SequenceAnalyzer</a>&amp; points );
<a name="l00183"></a>00183 
<a name="l00188"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a6f5fa377e0b3000b81d2de46c3dc13bf">00188</a>     <span class="keyword">inline</span> <span class="keywordtype">int</span> getNumViews( )<span class="keyword"> const</span>
<a name="l00189"></a>00189 <span class="keyword">    </span>{
<a name="l00190"></a>00190       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxImg=0;
<a name="l00191"></a>00191       std::vector&lt;TrackOfPoints&gt;::size_type key_size = tracks_.size( ),
<a name="l00192"></a>00192         i=0;
<a name="l00193"></a>00193       <span class="keywordflow">for</span> ( i=0; i &lt; key_size; i++ )
<a name="l00194"></a>00194       {
<a name="l00195"></a>00195         <span class="keyword">const</span> <a class="code" href="class_opencv_sf_m_1_1_track_of_points.html" title="This class store the track of keypoints. A track is a connected set of matching keypoints across mult...">TrackOfPoints</a> &amp;track = tracks_[ i ];
<a name="l00196"></a>00196         <span class="keywordtype">int</span> nviews = track.<a class="code" href="class_opencv_sf_m_1_1_track_of_points.html#a3a03a4468cd94b38de2b8a9787379801" title="List of image indexes of unordered points.">images_indexes_</a>.size( );
<a name="l00197"></a>00197         <span class="keywordflow">for</span>( <span class="keywordtype">int</span> j = 0;j&lt;nviews;++j )
<a name="l00198"></a>00198           <span class="keywordflow">if</span>( maxImg&lt;track.<a class="code" href="class_opencv_sf_m_1_1_track_of_points.html#a3a03a4468cd94b38de2b8a9787379801" title="List of image indexes of unordered points.">images_indexes_</a>[ j ] )
<a name="l00199"></a>00199             maxImg=track.<a class="code" href="class_opencv_sf_m_1_1_track_of_points.html#a3a03a4468cd94b38de2b8a9787379801" title="List of image indexes of unordered points.">images_indexes_</a>[ j ];
<a name="l00200"></a>00200       }
<a name="l00201"></a>00201       <span class="keywordflow">return</span> maxImg;
<a name="l00202"></a>00202     }
<a name="l00203"></a>00203 
<a name="l00209"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a15f269f2df8a26c650ef2260106cff2d">00209</a>     <span class="keyword">inline</span> cv::Mat <a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#a15f269f2df8a26c650ef2260106cff2d">getImage</a>( <span class="keywordtype">int</span> idx ) { <span class="keywordflow">return</span> images_[ idx ]; };
<a name="l00210"></a>00210 
<a name="l00217"></a>00217     <span class="keyword">inline</span> <span class="keywordtype">void</span> addMatches( std::vector&lt;cv::DMatch&gt; &amp;newMatches,
<a name="l00218"></a>00218       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> img1, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> img2 );
<a name="l00223"></a>00223     <span class="keywordtype">void</span> addTracks( std::vector&lt;TrackOfPoints&gt; &amp;newTracks );
<a name="l00227"></a>00227     <span class="keywordtype">void</span> constructImagesGraph( );
<a name="l00232"></a>00232     std::vector&lt; unsigned int &gt; getColors( );
<a name="l00237"></a>00237     std::vector&lt; cv::Vec3d &gt; get3DStructure( );
<a name="l00243"></a>00243     <span class="keywordtype">void</span> showPointsOnImage(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i,
<a name="l00244"></a>00244       <span class="keyword">const</span> std::vector&lt;cv::Vec2d&gt;&amp; pixelProjection);
<a name="l00245"></a>00245 
<a name="l00250"></a><a class="code" href="class_opencv_sf_m_1_1_sequence_analyzer.html#adda4f337df8e5672ea8999441ee258b7">00250</a>     <span class="keyword">inline</span> std::vector&lt; cv::Ptr&lt; PointsToTrack &gt; &gt; getPointsToTrack()
<a name="l00251"></a>00251     { <span class="keywordflow">return</span> points_to_track_; };
<a name="l00252"></a>00252   };
<a name="l00253"></a>00253 
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sun Aug 21 2011 16:45:52 for GSoC2011SfM by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
